
<!doctype html> 
<html> 
<head> 
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>万能码</title>
   
    

</head>
<body>
    <iframe src="https://appmodx1vyd6189.h5.xiaoeknow.com/v1/course/alive/l_5e846605d91ca_MEoUyqqX?type=2&app_id=appmodx1VyD6189&is_redirect=1" name="sendMessage"></iframe>  
</body>
<script type="text/javascript">
    
    //当前脚本
    let ifr = window.frames['sendMessage'];
       //使用iframe的window向iframe发送message。
    ifr.postmessage('give u a message', "http://tuhao.com");
    //tuhao.com的脚本
    window.addEventListener('message', receiver, false);
    function receiver(e) {
        if (e.origin == 'http://tuhao.com') {
            if (e.data == 'give u a message') {
                e.source.postMessage('received', e.origin);  //向原网页返回信息
            } else {
                alert(e.data);
            }
        }
    }
</script>
</html>
